home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- ** GALerTest.c
- *******************************************************************************
- **
- ** author: Christian Habermann, (c)1991-96 by Christian Habermann
- ** Asamstr. 17
- ** 85356 Freising
- ** Germany
- ** version: 2.0
- ** date: 07.02.1995
- **
- ** used compiler: SAS-C 6.51
- **
- *******************************************************************************
- **
- ** description:
- ** This is a program for testing GALer's hardware.
- **
- *******************************************************************************
- **
- ** changes:
- ** date | author | comment
- ** | |
- ** | |
- ******************************************************************************/
-
-
-
-
-
-
-
- /********************************* includes **********************************/
-
-
- #define STRINGARRAY 1
-
- #include <libraries/mui.h>
-
- #include <dos/dos.h>
- #include <graphics/gfxmacros.h>
- #include <workbench/workbench.h>
- #include <exec/memory.h>
- #include <exec/ports.h>
- #include <exec/types.h>
- #include <exec/interrupts.h>
- #include <intuition/intuition.h>
- #include <libraries/locale.h>
- #include <resources/misc.h>
- #include <resources/cia.h>
- #include <hardware/cia.h>
-
- #include <clib/alib_protos.h>
- #include <proto/asl.h>
- #include <proto/dos.h>
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <proto/locale.h>
- #include <proto/muimaster.h>
- #include <proto/reqtools.h>
- #include <proto/misc.h>
- #include <proto/cia.h>
-
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
-
- #include "GALer.h"
- #include "LocGT.h"
-
-
-
-
-
- /********************************* defines ***********************************/
-
- #ifndef MAKE_ID
- #define MAKE_ID(a,b,c,d)\
- ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
- #endif
-
-
- #define GADID_CONT 1
- #define GADID_CANCEL 2
- #define GADID_VER_OK 3
-
-
- #define ciaa (*((struct CIA *)0xbfe001))
- #define ciab (*((struct CIA *)0xbfd000))
-
-
-
-
-
-
- /******************************** functions **********************************/
-
- static void Clear(void);
- static void OpenStuff(void);
- static void CloseStuff(void);
- static int GetTimer(void);
- static void FreeTimer(void);
- static void Print(UBYTE *text);
- static int GetParPort(void);
- static void FreeParPort(void);
- static int GetCIATimer(void);
- static void FreeCIATimer(void);
- static void dummy_interrupt(void);
- static int GetHardwareVersion(void);
- static void WaitForAction(void);
-
- void main(void);
-
-
- #ifdef LATTICE
- int CXBRK(void) { return(0); } /* disable Lattice CTRL/C handling */
- int chkabort(void) { return(0); }
- #endif
-
-
-
-
-
-
- /******************************** variables **********************************/
-
- extern int hw_version;
-
- extern struct Library *SysBase;
-
- extern char *cia_timer_low, *cia_timer_high, *cia_timer_cr;
-
- extern char cia_timer_start, cia_timer_stop;
-
-
- struct MsgPort *timeport;
- struct timerequest *timereq;
- struct Library *LocaleBase;
- struct Library *MiscBase;
- struct Library *CIABase;
- struct Library *MUIMasterBase;
- struct IntuiMessage *message;
- struct Catalog *catalog;
-
- WORD selected_timer;
-
- int prog_volt = 0; /* dummy for port.o module */
-
- int GALType, outIC1, outIC2, outIC3, outIC4, outIC5;
-
- LONG __stack = 8192;
-
- static APTR app, main_win, version_win;
- static APTR BT_cont, BT_cancel, BT_ok;
- static APTR LV_text;
- static APTR RD_version;
-
-
- static const char *RD_entries[] = { "V1.0 / V1.1",
- "V1.2",
- "V1.3",
- NULL
- };
-
-
- static struct Interrupt CIATimerInterrupt =
- {{0, 0, NT_INTERRUPT, 0, "GALerTest"}, NULL, &dummy_interrupt};
-
-
-
- static UBYTE prog_name[] = "GALerTest";
-
-
-
-
-
-
-
- /******************************************************************************
- ** main()
- *******************************************************************************
- ** input: none
- ** output: none
- ** remarks: this is the main function
- ******************************************************************************/
-
- void main(void)
- {
-
- int errorIC6a, errorIC6c, errorIC7;
-
-
-
- OpenStuff();
-
-
- if (!GetParPort()) /* get parallel port */
- {
- puts((char *)AppStrings[MSG_ERR_PARPORT].as_Str);
- CloseStuff();
- exit(20);
- }
-
-
- /* get any CIA timer */
- if (!GetCIATimer())
- {
- RestoreParPort();
- FreeParPort();
- puts((char *)AppStrings[MSG_ERR_CIATIMER].as_Str);
- CloseStuff();
- exit(20);
- }
- /* open timer device */
-
-
- if (!GetTimer())
- {
- RestoreParPort();
- FreeParPort();
- FreeCIATimer();
- puts((char *)AppStrings[MSG_ERR_TIMER].as_Str);
- CloseStuff();
- exit(20);
- }
-
-
-
-
- Print(AppStrings[MSG_INTRO_TXT].as_Str);
- WaitForAction();
-
-
- /* get hardware version */
-
- set(main_win, MUIA_Window_Sleep, TRUE); /* deactivate main window */
-
- if (!GetHardwareVersion()) /* open version window */
- {
- FreeTimer(); /* if failed, free resources */
- CloseStuff();
- puts(AppStrings[MSG_ERR_WIN].as_Str);
- exit(20);
- }
-
- set(main_win, MUIA_Window_Sleep, FALSE); /* activate main window */
-
-
-
-
- InitParPort(); /* set CIAs */
-
- InitHardware(); /* initialize GALer */
-
-
- Clear();
- Print(AppStrings[MSG_TEST1_TXT].as_Str);
- EnableOutput();
- WriteByte(0x00, IC3);
- WriteByte(0x00, IC4);
- WriteByte(0x00, IC5);
- WaitForAction();
-
-
- Clear();
- Print(AppStrings[MSG_TEST2_TXT].as_Str);
- LED(ON);
- WaitForAction();
-
-
- Clear();
- Print(AppStrings[MSG_TEST3_TXT].as_Str);
- LED(OFF);
- WaitForAction();
-
-
- Clear();
- Print(AppStrings[MSG_TEST4_TXT].as_Str);
- SetGAL(GAL20V8);
- EnableVcc();
- WaitForAction();
-
-
- Clear();
- Print(AppStrings[MSG_TEST5_TXT].as_Str);
- DisableVcc();
- SetGAL(GAL16V8);
- EnableVcc();
- WaitForAction();
-
-
- Clear();
- Print(AppStrings[MSG_TEST6_TXT].as_Str);
- InitHardware();
- EnableOutput();
- WriteByte(0xff, IC3);
- WriteByte(0xff, IC4);
- WriteByte(0xff, IC5);
- WaitForAction();
-
-
- Clear();
- Print(AppStrings[MSG_TEST7_TXT].as_Str);
- SetGAL(GAL20V8);
- EnableVcc();
- WriteByte(0x55, IC3);
- WriteByte(0x55, IC4);
- WriteByte(0x55, IC5);
- WaitForAction();
-
-
- Clear();
- Print(AppStrings[MSG_TEST8_TXT].as_Str);
- DisableVcc();
- WriteByte(0xaa, IC3);
- WriteByte(0xaa, IC4);
- WriteByte(0xaa, IC5);
- WaitForAction();
-
- DisableVcc();
- InitHardware();
- EnableOutput();
- VeditOn();
-
-
- /* adjust edit voltages */
- switch (hw_version)
- {
- case HW_GALER_1_2:
- case HW_GALER_1_3:
-
- Clear();
- Print(AppStrings[MSG_TEST9_TXT].as_Str);
- SetVolt(0);
- SetGAL(GAL20V8);
- EnableVEdit();
- WaitForAction();
-
- Clear();
- Print(AppStrings[MSG_TEST10_TXT].as_Str);
- SetVolt(1);
- WaitForAction();
-
- Clear();
- Print(AppStrings[MSG_TEST11_TXT].as_Str);
- SetVolt(2);
- WaitForAction();
-
- Clear();
- Print(AppStrings[MSG_TEST12_TXT].as_Str);
- SetVolt(3);
- WaitForAction();
-
- Clear();
- Print(AppStrings[MSG_TEST13_TXT].as_Str);
- SetVolt(4);
- WaitForAction();
-
- Print(AppStrings[MSG_TEST14_TXT].as_Str);
- WaitForAction();
-
- Clear();
- Print(AppStrings[MSG_TEST15_TXT].as_Str);
- DisableVEdit();
- SetGAL(GAL16V8);
- EnableVEdit();
- WaitForAction();
-
- break;
-
-
- case HW_GALER_1_0:
-
- Clear();
- Print(AppStrings[MSG_TEST22_TXT].as_Str);
- SetVolt(0);
- SetGAL(GAL20V8);
- EnableVEdit();
- WaitForAction();
-
- Clear();
- Print(AppStrings[MSG_TEST23_TXT].as_Str);
- DisableVEdit();
- SetGAL(GAL16V8);
- EnableVEdit();
- WaitForAction();
-
- break;
- }
-
-
- /* check GALer's read functions */
- Clear();
-
- if (hw_version >= HW_GALER_1_3)
- Print(AppStrings[MSG_TEST16_TXT].as_Str);
- else
- Print(AppStrings[MSG_TEST25_TXT].as_Str);
-
- SetGAL(GAL20V8);
- InitHardware();
- EnableVcc();
- EnableOutput();
-
- errorIC6a = errorIC6c = errorIC7 = 0;
-
- /* test IC6a */
- WriteByte(0x40, IC3);
- if (!ReadByte(IC6a))
- errorIC6a = 1;
-
- WriteByte(0x00, IC3);
- if (ReadByte(IC6a))
- errorIC6a = 1;
-
-
- /* test IC6c */
- if (hw_version >= HW_GALER_1_3)
- {
- WriteByte(0x80, IC3);
- if (!ReadByte(IC6c))
- errorIC6c = 1;
-
- WriteByte(0x00, IC3);
- if (ReadByte(IC6c))
- errorIC6c = 1;
- }
-
-
- /* test IC7 */
- WriteByte(0x00, IC5);
- if (ReadByte(IC7))
- errorIC7 = 1;
-
- WriteByte(0x2A, IC3);
- WriteByte(0x20, IC5);
- if (ReadByte(IC7) != 0xAA)
- errorIC7 = 1;
-
- WriteByte(0x15, IC3);
- WriteByte(0x10, IC5);
- if (ReadByte(IC7) != 0x55)
- errorIC7 = 1;
-
-
-
- DisableVcc();
- DisableOutput();
-
-
-
-
- if (errorIC6c || errorIC6a || errorIC7)
- {
-
- Print(AppStrings[MSG_TEST17_TXT].as_Str);
-
- if (errorIC6a)
- Print(AppStrings[MSG_TEST18_TXT].as_Str);
-
-
- if (errorIC7)
- Print(AppStrings[MSG_TEST19_TXT].as_Str);
-
-
- if (errorIC6c)
- Print(AppStrings[MSG_TEST20_TXT].as_Str);
- }
- else
- {
- if (hw_version == HW_GALER_1_0)
- Print(AppStrings[MSG_TEST24_TXT].as_Str);
- else
- Print(AppStrings[MSG_TEST21_TXT].as_Str);
- }
-
-
- /* rename cancel-gadget to */
- /* -> end-gadget */
- set(BT_cancel, MUIA_Text_Contents, AppStrings[MSG_END_GAD].as_Str);
-
-
- set(BT_cont, MUIA_Disabled, TRUE); /* disable cont-gadget */
-
-
- WaitForAction();
-
-
- RestoreParPort(); /* shut down */
-
- FreeParPort();
-
- FreeCIATimer();
-
- FreeTimer();
-
- CloseStuff();
-
- exit(0); /* that's it */
- }
-
-
-
-
-
- /******************************************************************************
- ** GetParPort()
- *******************************************************************************
- ** input: none
- **
- ** output: TRUE: ok
- ** FALSE: parallel port in use
- **
- ** remarks: allocate Amiga's parallel port
- ******************************************************************************/
-
- static int GetParPort(void)
- {
-
- /* get parallel port */
-
- if (!(MiscBase = (struct Library *)OpenResource(MISCNAME)))
- {
- return FALSE;
- }
-
-
- if (AllocMiscResource(MR_PARALLELPORT, prog_name))
- {
- return FALSE;
- }
-
-
- if (AllocMiscResource(MR_PARALLELBITS, prog_name))
- {
- FreeMiscResource(MR_PARALLELPORT);
- return FALSE;
- }
-
-
-
- InitParPort(); /* init data direction register */
-
- return TRUE;
- }
-
-
-
-
-
- /******************************************************************************
- ** FreeParPort()
- *******************************************************************************
- ** input: none
- ** output: none
- **
- ** remarks: free Amiga's parallel port
- ******************************************************************************/
-
- static void FreeParPort(void)
- {
-
- RestoreParPort(); /* restore the state of the */
- /* parallel port */
-
- FreeMiscResource(MR_PARALLELBITS); /* free parallel port */
- FreeMiscResource(MR_PARALLELPORT);
-
- }
-
-
-
-
-
- /******************************************************************************
- ** GetCIATimer()
- *******************************************************************************
- ** input: none
- ** output: TRUE: o.k.
- ** FALSE: failed to get any CIA timer
- **
- ** remarks: try to get one of the four CIA timers and initialize it
- ******************************************************************************/
-
- static int GetCIATimer(void)
- {
-
-
- /* at first try to get one of the CIA-A timers */
-
- if ((CIABase = (struct Library *)OpenResource(CIAANAME)))
- {
- /* try to get timer A */
- /* (interrupt is just a dummy) */
-
- if (!(AddICRVector(CIABase, CIAICRB_TA, &CIATimerInterrupt)))
- {
- AbleICR(CIABase, CIAICRB_TA); /* disable timer A interrupt */
-
- selected_timer = CIAICRB_TA;
-
- cia_timer_low = &ciaa.ciatalo; /* init some variables */
- cia_timer_high = &ciaa.ciatahi;
- cia_timer_cr = &ciaa.ciacra;
-
- cia_timer_start = ciaa.ciacra & (CIACRAF_SPMODE | CIACRAF_TODIN) |
- CIACRAF_START | CIACRAF_LOAD;
-
- cia_timer_stop = cia_timer_start & ~CIACRAF_START;
-
- return TRUE;
- }
- /* try to get timer B */
-
- if (!(AddICRVector(CIABase, CIAICRB_TB, &CIATimerInterrupt)))
- {
- AbleICR(CIABase, CIAICRB_TB); /* disable timer B interrupt */
-
- selected_timer = CIAICRB_TB;
-
- cia_timer_low = &ciaa.ciatblo; /* init some variables */
- cia_timer_high = &ciaa.ciatbhi;
- cia_timer_cr = &ciaa.ciacrb;
-
- cia_timer_start = ciaa.ciacrb & CIACRBF_ALARM |
- CIACRBF_START | CIACRBF_LOAD;
-
- cia_timer_stop = cia_timer_start & ~CIACRBF_START;
-
- return TRUE;
- }
-
- }
-
-
- /* now try to get one of the CIA-B timers */
-
- if ((CIABase = (struct Library *)OpenResource(CIABNAME)))
- {
- /* try to get timer A */
-
- if (!(AddICRVector(CIABase, CIAICRB_TA, &CIATimerInterrupt)))
- {
- AbleICR(CIABase, CIAICRB_TA); /* disable timer A interrupt */
-
- selected_timer = CIAICRB_TA;
-
- cia_timer_low = &ciab.ciatalo; /* init some variables */
- cia_timer_high = &ciab.ciatahi;
- cia_timer_cr = &ciab.ciacra;
-
- cia_timer_start = ciab.ciacra & (CIACRAF_SPMODE | CIACRAF_TODIN) |
- CIACRAF_START | CIACRAF_LOAD;
-
- cia_timer_stop = cia_timer_start & ~CIACRAF_START;
-
- return TRUE;
- }
- /* try to get timer B */
-
- if (!(AddICRVector(CIABase, CIAICRB_TB, &CIATimerInterrupt)))
- {
- AbleICR(CIABase, CIAICRB_TB); /* disable timer B interrupt */
-
- selected_timer = CIAICRB_TB;
-
- cia_timer_low = &ciab.ciatblo; /* init some variables */
- cia_timer_high = &ciab.ciatbhi;
- cia_timer_cr = &ciab.ciacrb;
-
- cia_timer_start = ciab.ciacrb & CIACRBF_ALARM |
- CIACRBF_START | CIACRBF_LOAD;
-
- cia_timer_stop = cia_timer_start & ~CIACRBF_START;
-
- return TRUE;
- }
-
- }
-
-
- return FALSE;
- }
-
-
-
-
-
- /******************************************************************************
- ** FreeCIATimer()
- *******************************************************************************
- ** input: none
- ** output: none
- **
- ** remarks: free CIA timer
- ******************************************************************************/
-
- static void FreeCIATimer(void)
- {
-
- RemICRVector(CIABase, selected_timer, &CIATimerInterrupt);
-
- }
-
-
-
-
-
- /******************************************************************************
- ** dummy_interrupt()
- *******************************************************************************
- ** input: none
- ** output: none
- **
- ** remarks: This is just a dummy function. It's needed for the interrupt
- ** structure necessary to test whether or not a CIA timer is free.
- ** __interrupt is a SAS-C keyword. This keyword turns off stack
- ** checking.
- ******************************************************************************/
-
- __interrupt static void dummy_interrupt(void)
- {
- return;
- }
-
-
-
-
-
-
- /******************************************************************************
- ** GetTimer()
- *******************************************************************************
- ** input: none
- ** output: TRUE: ok
- ** FALSE: failed to open device
- **
- ** remarks: open timer device
- ******************************************************************************/
-
- static int GetTimer(void)
- {
-
- timeport = CreatePort(0L,0L);
-
- if (timeport == NULL)
- return FALSE;
-
- timereq = (struct timerequest *)AllocMem(
- (long)sizeof(struct timerequest), MEMF_PUBLIC);
-
- if (timereq == NULL)
- {
- DeletePort(timeport);
- return FALSE;
- }
-
-
- timereq->tr_node.io_Message.mn_Node.ln_Type = NT_MESSAGE;
- timereq->tr_node.io_Message.mn_Node.ln_Pri = 0;
- timereq->tr_node.io_Message.mn_ReplyPort = timeport;
-
-
- if (OpenDevice(TIMERNAME, UNIT_MICROHZ, (struct IORequest *)timereq, 0L))
- {
- FreeMem(&timereq, (long)sizeof(struct timerequest));
- DeletePort(timeport);
- return FALSE;
- }
-
-
- return TRUE;
- }
-
-
-
-
-
- /******************************************************************************
- ** FreeTimer()
- *******************************************************************************
- ** input: none
- ** output: none
- ** remarks: free timer device
- ******************************************************************************/
-
- static void FreeTimer(void)
- {
-
- CloseDevice((struct IORequest *)timereq);
-
- FreeMem(timereq, (long)sizeof(struct timerequest));
-
- DeletePort(timeport);
- }
-
-
-
-
-
- /******************************************************************************
- ** WaitForTimer()
- *******************************************************************************
- ** input: micro time in micro seconds
- ** output: none
- **
- ** remarks: wait "micro" micro seconds
- ******************************************************************************/
-
- void WaitForTimer(ULONG micro)
- {
-
- timereq->tr_node.io_Command = TR_ADDREQUEST;
- timereq->tr_time.tv_secs = 0;
- timereq->tr_time.tv_micro = micro;
-
- DoIO((struct IORequest *)timereq);
- }
-
-
-
-
-
- /******************************************************************************
- ** Clear()
- *******************************************************************************
- ** input: none
- ** output: none
- **
- ** remarks: clears listview's list
- ******************************************************************************/
-
- static void Clear(void)
- {
-
- DoMethod(LV_text, MUIM_List_Clear); /* clear list */
-
- }
-
-
-
-
-
-
- /******************************************************************************
- ** Print()
- *******************************************************************************
- ** input: *txt pointer to text
- ** output: none
- **
- ** remarks: This function adds a string to the list of the
- ** listview. CRs within the string are allowed.
- ******************************************************************************/
-
- static void Print(UBYTE *txt)
- {
- #define LINE_LENGTH 82 /* max. length of string */
-
- int cntr;
- char line[LINE_LENGTH];
-
-
-
- for(;;)
- {
- line[0] = 0;
- cntr = 0; /* search CR or end of */
- /* string */
- while (*txt != 0x00 && *txt != 0x0A && cntr < LINE_LENGTH)
- {
- line[cntr++] = *txt++; /* copy line into line-array */
- }
-
-
- line[cntr] = 0; /* set end of line */
-
-
- DoMethod(LV_text, MUIM_List_InsertSingle, /* add line to */
- line, MUIV_List_Insert_Bottom); /* the listview */
-
- if (!*txt) /* end of string reached? */
- break;
-
- txt++;
- }
-
-
- DoMethod(LV_text, MUIM_List_Jump, 0); /* make first entry visible */
- }
-
-
-
-
-
- /******************************************************************************
- ** WaitForAction()
- *******************************************************************************
- ** input: none
- ** output: none
- **
- ** remarks: This function does wait for any action done by the user
- ** and executes the according function.
- ******************************************************************************/
-
- static void WaitForAction(void)
- {
- ULONG signal;
-
-
- for(;;)
- {
- switch (DoMethod(app, MUIM_Application_Input, &signal))
- {
- /* exit GALerTest */
- case MUIV_Application_ReturnID_Quit: /* close gadget */
- case GADID_CANCEL: /* cancel gadget */
- DisableVcc();
- DisableOutput();
- LED(OFF);
- CloseStuff();
- RestoreParPort();
- FreeParPort();
- FreeCIATimer();
- FreeTimer();
- exit(0);
- break;
-
-
- case GADID_CONT: /* continue... */
- return;
- break;
- }
-
-
- if (signal)
- Wait(signal);
-
- }
- }
-
-
-
-
-
- /******************************************************************************
- ** GetHardwareVersion()
- *******************************************************************************
- ** input: none
- ** output: TRUE: all ok
- ** FALSE: failed to open window
- **
- ** remarks: This function opens the version window and deals with
- ** user's inputs.
- ******************************************************************************/
-
- static int GetHardwareVersion(void)
- {
- ULONG signal, radio;
- LONG result;
-
-
- set(version_win, MUIA_Window_Open, TRUE); /* open version window */
- get(version_win, MUIA_Window_Open, &result);
-
- if (!result)
- return FALSE;
-
- /* wait for selection of OK */
- for(;;)
- {
- switch (DoMethod(app, MUIM_Application_Input, &signal))
- {
- case MUIV_Application_ReturnID_Quit: /* close gadget */
- case GADID_VER_OK: /* OK is selected */
-
- get(RD_version, MUIA_Radio_Active, &radio);
-
- switch(radio)
- {
- case 0:
- hw_version = HW_GALER_1_0;
- break;
-
- case 1:
- hw_version = HW_GALER_1_2;
- break;
-
- case 2:
- hw_version = HW_GALER_1_3;
- break;
- }
-
- set(version_win, MUIA_Window_Open, FALSE);
-
- return TRUE;
- break;
- }
-
-
- if (signal) /* wait for the next action */
- Wait(signal);
-
- }
-
- }
-
-
-
-
-
- /******************************************************************************
- ** openstruff()
- *******************************************************************************
- ** input: none
- ** output: none
- **
- ** remarks: This function does open all libraries and the MUI
- ** application.
- ******************************************************************************/
-
- static void OpenStuff(void)
- {
- LONG result;
-
-
-
- if (LocaleBase = OpenLibrary("locale.library", 38L))
- catalog = OpenCatalog(NULL, (STRPTR)"GALerTest.catalog",
- OC_Version, 2, TAG_DONE);
-
- LocalizeText();
-
-
- if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
- {
-
- puts(AppStrings[MSG_ERR_MUILIB].as_Str);
- CloseStuff();
- exit(20);
- }
-
-
- /* create application window, gadgets...*/
-
- /* main window */
- app = ApplicationObject,
- MUIA_Application_Title, "GALerTest",
- MUIA_Application_Version, "$VER: GALerTest 2.0 (17.03.96)",
- MUIA_Application_Copyright, "©1991-96, Christian Habermann",
- MUIA_Application_Author, "Christian Habermann",
- MUIA_Application_Description, "Program for testing GALer's hardware.",
- MUIA_Application_Base, "GALERTEST",
-
- SubWindow, main_win = WindowObject,
- MUIA_Window_Title, "GALerTest V2.0, ©1991-96 by Christian Habermann",
- MUIA_Window_ID , MAKE_ID('G','A','T','S'),
-
- WindowContents, GroupObject,
- Child, LV_text = ListviewObject,
- MUIA_Listview_Input, FALSE,
- MUIA_Listview_List, ListObject,
- MUIA_List_ConstructHook, MUIV_List_ConstructHook_String,
- MUIA_List_DestructHook, MUIV_List_DestructHook_String,
- ReadListFrame,
- End,
- End,
-
- Child, GroupObject,
- MUIA_Group_Horiz, TRUE,
- MUIA_Group_SameWidth, TRUE,
- Child, BT_cont = SimpleButton(AppStrings[MSG_CONT_GAD].as_Str),
- MUIA_Text_SetMax, TRUE,
- Child, BT_cancel = SimpleButton(AppStrings[MSG_CANCEL_GAD].as_Str),
- MUIA_Text_SetMax, TRUE,
- End,
- End,
- End,
-
- /* hardware version window */
-
- SubWindow, version_win = WindowObject,
- MUIA_Window_Title, "GALerTest",
- MUIA_Window_ID , MAKE_ID('V','E','R','S'),
-
- WindowContents, GroupObject,
- Child, TextObject, GroupFrame,
- MUIA_Background, MUII_SHADOWFILL,
- MUIA_Text_Contents, AppStrings[MSG_SELVER_TXT].as_Str,
- End,
-
- Child, RD_version = Radio(AppStrings[MSG_VERSION_TXT].as_Str, RD_entries),
-
- Child, BT_ok = SimpleButton("_OK"),
- MUIA_Text_SetMax, TRUE,
- End,
- End,
- End;
-
-
-
- if (!app)
- {
- CloseStuff();
- puts(AppStrings[MSG_ERR_MUIAPP].as_Str);
- exit(20);
- }
-
-
- /* set notifies */
-
- DoMethod(main_win, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
- app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
-
- DoMethod(version_win, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
- app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
-
-
-
- DoMethod(BT_cont ,MUIM_Notify, MUIA_Pressed, FALSE,
- app, 2, MUIM_Application_ReturnID, GADID_CONT);
-
- DoMethod(BT_cancel ,MUIM_Notify, MUIA_Pressed, FALSE,
- app, 2, MUIM_Application_ReturnID, GADID_CANCEL);
-
-
- DoMethod(BT_ok ,MUIM_Notify, MUIA_Pressed, FALSE,
- app, 2, MUIM_Application_ReturnID, GADID_VER_OK);
-
-
-
- /* set TAB cycle chain */
-
- DoMethod(main_win, MUIM_Window_SetCycleChain, BT_cont, BT_cancel, NULL);
- DoMethod(version_win, MUIM_Window_SetCycleChain, RD_version, BT_ok, NULL);
-
- set(RD_version ,MUIA_Radio_Active, 2); /* default version 1.3 */
-
-
-
- set(main_win, MUIA_Window_Open, TRUE); /* open application window...*/
- get(main_win, MUIA_Window_Open, &result);
-
- if (!result)
- {
- CloseStuff();
- puts(AppStrings[MSG_ERR_WIN].as_Str);
- exit(20);
- }
-
- }
-
-
-
-
-
- /******************************************************************************
- ** CloseStuff()
- *******************************************************************************
- ** input: none
- ** output: none
- **
- ** remarks: closes the MUI application and all libraries
- ******************************************************************************/
-
- static void CloseStuff(void)
- {
-
- if (app)
- MUI_DisposeObject(app);
-
-
- if (LocaleBase)
- {
- CloseCatalog(catalog);
- CloseLibrary((struct Library *)LocaleBase);
- }
-
-
- if (MUIMasterBase)
- CloseLibrary(MUIMasterBase);
-
- }
-
-
-
-
-
- /******************************************************************************
- ** LocalizeText()
- *******************************************************************************
- ** input: none
- ** output: none
- **
- ** remarks: localizes all strings
- ******************************************************************************/
-
- void LocalizeText(void)
- {
-
- if (LocaleBase && catalog)
- {
-
- AppStrings[MSG_END_GAD].as_Str = GetCatalogStr(catalog, MSG_END_GAD, AppStrings[MSG_END_GAD].as_Str);
- AppStrings[MSG_CANCEL_GAD].as_Str = GetCatalogStr(catalog, MSG_CANCEL_GAD, AppStrings[MSG_CANCEL_GAD].as_Str);
- AppStrings[MSG_CONT_GAD].as_Str = GetCatalogStr(catalog, MSG_CONT_GAD, AppStrings[MSG_CONT_GAD].as_Str);
- AppStrings[MSG_ERR_TIMER].as_Str = GetCatalogStr(catalog, MSG_ERR_TIMER, AppStrings[MSG_ERR_TIMER].as_Str);
- AppStrings[MSG_ERR_CIATIMER].as_Str = GetCatalogStr(catalog, MSG_ERR_CIATIMER, AppStrings[MSG_ERR_CIATIMER].as_Str);
- AppStrings[MSG_ERR_PARPORT].as_Str = GetCatalogStr(catalog, MSG_ERR_PARPORT, AppStrings[MSG_ERR_PARPORT].as_Str);
- AppStrings[MSG_ERR_MUILIB].as_Str = GetCatalogStr(catalog, MSG_ERR_MUILIB, AppStrings[MSG_ERR_MUILIB].as_Str);
- AppStrings[MSG_ERR_MUIAPP].as_Str = GetCatalogStr(catalog, MSG_ERR_MUIAPP, AppStrings[MSG_ERR_MUIAPP].as_Str);
- AppStrings[MSG_ERR_WIN].as_Str = GetCatalogStr(catalog, MSG_ERR_WIN, AppStrings[MSG_ERR_WIN].as_Str);
- AppStrings[MSG_SELVER_TXT].as_Str = GetCatalogStr(catalog, MSG_SELVER_TXT, AppStrings[MSG_SELVER_TXT].as_Str);
- AppStrings[MSG_VERSION_TXT].as_Str = GetCatalogStr(catalog, MSG_VERSION_TXT, AppStrings[MSG_VERSION_TXT].as_Str);
- AppStrings[MSG_INTRO_TXT].as_Str = GetCatalogStr(catalog, MSG_INTRO_TXT, AppStrings[MSG_INTRO_TXT].as_Str);
- AppStrings[MSG_TEST1_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST1_TXT, AppStrings[MSG_TEST1_TXT].as_Str);
- AppStrings[MSG_TEST2_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST2_TXT, AppStrings[MSG_TEST2_TXT].as_Str);
- AppStrings[MSG_TEST3_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST3_TXT, AppStrings[MSG_TEST3_TXT].as_Str);
- AppStrings[MSG_TEST4_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST4_TXT, AppStrings[MSG_TEST4_TXT].as_Str);
- AppStrings[MSG_TEST5_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST5_TXT, AppStrings[MSG_TEST5_TXT].as_Str);
- AppStrings[MSG_TEST6_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST6_TXT, AppStrings[MSG_TEST6_TXT].as_Str);
- AppStrings[MSG_TEST7_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST7_TXT, AppStrings[MSG_TEST7_TXT].as_Str);
- AppStrings[MSG_TEST8_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST8_TXT, AppStrings[MSG_TEST8_TXT].as_Str);
- AppStrings[MSG_TEST9_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST9_TXT, AppStrings[MSG_TEST9_TXT].as_Str);
- AppStrings[MSG_TEST10_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST10_TXT, AppStrings[MSG_TEST10_TXT].as_Str);
- AppStrings[MSG_TEST11_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST11_TXT, AppStrings[MSG_TEST11_TXT].as_Str);
- AppStrings[MSG_TEST12_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST12_TXT, AppStrings[MSG_TEST12_TXT].as_Str);
- AppStrings[MSG_TEST13_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST13_TXT, AppStrings[MSG_TEST13_TXT].as_Str);
- AppStrings[MSG_TEST14_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST14_TXT, AppStrings[MSG_TEST14_TXT].as_Str);
- AppStrings[MSG_TEST15_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST15_TXT, AppStrings[MSG_TEST15_TXT].as_Str);
- AppStrings[MSG_TEST16_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST16_TXT, AppStrings[MSG_TEST16_TXT].as_Str);
- AppStrings[MSG_TEST17_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST17_TXT, AppStrings[MSG_TEST17_TXT].as_Str);
- AppStrings[MSG_TEST18_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST18_TXT, AppStrings[MSG_TEST18_TXT].as_Str);
- AppStrings[MSG_TEST19_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST19_TXT, AppStrings[MSG_TEST19_TXT].as_Str);
- AppStrings[MSG_TEST20_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST20_TXT, AppStrings[MSG_TEST20_TXT].as_Str);
- AppStrings[MSG_TEST21_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST21_TXT, AppStrings[MSG_TEST21_TXT].as_Str);
- AppStrings[MSG_TEST22_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST22_TXT, AppStrings[MSG_TEST22_TXT].as_Str);
- AppStrings[MSG_TEST23_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST23_TXT, AppStrings[MSG_TEST23_TXT].as_Str);
- AppStrings[MSG_TEST24_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST24_TXT, AppStrings[MSG_TEST24_TXT].as_Str);
- AppStrings[MSG_TEST25_TXT].as_Str = GetCatalogStr(catalog, MSG_TEST25_TXT, AppStrings[MSG_TEST25_TXT].as_Str);
-
- }
-
- }
-
-
-
- /* EOF */
-